package Scene4;
import Picture.GameImage;
import Scene1.Scene1;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;

public class AnimalPanel2 extends JPanel {
    public int allEnd = 0;

    Sleep sleep = new Sleep();
    Scene1 scene1 = new Scene1();


    Scene4 scene = new Scene4();
    BufferedImage imgF = scene.stackFont.pop();
    BufferedImage imgP = GameImage.get("/Picture/Scene2/bg.png");

    public void resize(JFrame frame){
        frame.setSize(1536,1110);
    }
    public void changeFont(){
        imgF = scene.stackFont.pop();
        repaint();
    }
    public void changePic(){
        imgP = scene.stackPic.pop();
        repaint();
    }

public wolf wolf = new wolf();

    public AnimalPanel2(){

        new Thread(()->{

            try {
                while(true) {
                    sleep.changeImage();
                    repaint();
                    Thread.sleep(100);
                    if(flg==1){
                        wolf.changeImage();
                        if(wolf.x<500)
                        wolf.x+=10;

                    }
                }

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

    }
    public int flg = 0;



    public void paint(Graphics g){


        super.paint(g);
        g.drawImage(scene.map.get("bg"), 0, 0, null);
        g.drawImage(sleep.img,800,700,null);
        g.drawImage(GameImage.get("/Picture/Animal/npc.png"),-120,450,null);
        g.drawImage(scene1.map.get("聊天框"),250,800,null);
        g.drawImage(scene1.map.get("箭头"),1200,970,null);
        g.drawImage(imgF,360,870,null);
        if(flg==1)
        g.drawImage(wolf.img,wolf.x,wolf.y,null);




    }




}
